package cn.edu.lingnan.servlet;

import cn.edu.lingnan.pojo.User;
import cn.edu.lingnan.service.userservice;
import cn.edu.lingnan.service.userserviceimp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;
@WebServlet("/condition")
public class ConditionServlet extends HttpServlet {
    userservice us=new userserviceimp();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        List<User> userLikeName = us.getUserLikeName(name);
        HttpSession session = req.getSession();
//        session.setAttribute("userLikeName", userLikeName);
        req.setAttribute("userLikeName", userLikeName);

        // Redirect back to the student.jsp page
       // resp.sendRedirect("/admin/student1.jsp");
        req.getRequestDispatcher("/admin/student1.jsp").forward(req, resp);
    }
}
